package service.impl;

import dao.UserDao;
import entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import service.UserService;

import java.util.List;

@Service("userService")
@Transactional(propagation = Propagation.REQUIRED)
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDao userDao;
    @Override
    public Integer getcount(User user) {
        return userDao.getcount(user);
    }

    @Override
    public List<User> getPageUsers(User user, Integer pageIndex, Integer pageSize) {
        return userDao.getPageUsers(user,pageIndex,pageSize);
    }

    @Override
    public Integer adduser(User user) {
        return userDao.adduser(user);
    }

    @Override
    public Integer deluser(Integer userid) {
        return userDao.deluser(userid);
    }

    @Override
    public User getUserById(Integer userid) {
        return userDao.getUserById(userid);
    }

    @Override
    public Integer updateuser(User user) {
        return userDao.updateuser(user);
    }

    @Override
    public Integer topUp(Integer userid, Double addmoney) {
        return userDao.topUp(userid,addmoney);
    }
}
